<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Login extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->database();
        $this->load->helper('url');
        $this->load->helper('file');
        $this->load->helper('fuc');
        $this->load->library('topclass');
        $this->load->library('session_db');
        $this->load->model("oauth_login");
        $this->load->model("users");       
        $this->config->load('topapiconfig');
    }

    public function actlogin() {

      $code = $_REQUEST['code'];   //通过访问https://oauth.taobao.com/authorize获取code       
        $res = $this->oauth_login->action_lognin($code);
        // print_r($res);
        $this->oauth_login->db_session($res); 
        $this->oauth_login->db_user();
        
       // redirect("home/tradetimeline");
       
    }

    public function index() {
        $website_config_array = $this->config->item('website_oauth');
        $oauth_url_array = $this->config->item('oauth_requert');
        $data["website_config_array"] = $website_config_array;
        $data["oauth_url_array"] = $oauth_url_array;
        $data['menu'] = 'index';
        $data['user'] = array();
        $this->load->view('header_view', $data);
        $this->load->view('login_view');
        $this->load->view('footer_view');
    }

    public function logout() {

        $this->auth_handle->logout_action();
    }

}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */